1 #import "BBFlatBezelInterface.h"
3 @interface BBFlatBezelInterface () {
8 @implementation BBFlatBezelInterface
11 return [self initWithWindowNibName:@"BBFlatBezelInterface"];
14 - (void)windowDidLoad {
15 initialRect = centerRectInRect([[self window] frame], [[NSScreen mainScreen] frame]);
17 [super windowDidLoad];
19 QSWindow *window = (QSWindow *)[self window];
20 [window setLevel:NSPopUpMenuWindowLevel];
21 [window setBackgroundColor:[NSColor clearColor]];
22 [window setOpaque:NO];
24 [window setHideOffset:NSMakePoint(0, 0)];
25 [window setShowOffset:NSMakePoint(0, 0)];
27 [window setMovableByWindowBackground:NO];
28 [window setFastShow:YES];
29 [window setHasShadow:YES];
31 [window setFrame:standardRect display:YES];
33 NSArray *theControls = [NSArray arrayWithObjects:dSelector, aSelector, iSelector, nil];
34 for(QSSearchObjectView *theControl in theControls) {
35 QSObjectCell *theCell = [theControl cell];
37 [theControl setPreferredEdge:NSMinYEdge];
38 [(QSWindow *)[(theControl)->resultController window] setHideOffset:NSMakePoint(0, NSMinY([iSelector frame]))];
39 [(QSWindow *)[(theControl)->resultController window] setShowOffset:NSMakePoint(0, NSMinY([dSelector frame]))];
41 [theCell setBackgroundColor:[NSColor clearColor]];
42 [theCell setFont:[NSFont systemFontOfSize:11 weight:NSFontWeightLight]];
43 [theCell setCellRadiusFactor:8];
45 [theCell setHighlightColor:[NSColor colorWithRed:1 green:1 blue:1 alpha:.15]];
46 [theCell setTextColor:[NSColor textColor]];
47 [theCell setShowDetails:NO];
48 [theCell setState:NSControlStateValueOn];
49 [theCell setIconSize:QSSize128];
50 [theCell setImagePosition:NSImageAbove];
53 [self contractWindow:nil];
56 - (NSSize) maxIconSize {
60 - (void)showMainWindow:(id)sender {
61 [[self window] setFrame:[self rectForState:[self expanded]] display:YES];
62 if ([[self window] isVisible]) [[self window] pulse:self];
63 [super showMainWindow:sender];
64 // Does this need to be here?
65 [[[self window] contentView] setNeedsDisplay:YES];
68 - (void)expandWindow:(id)sender {
70 [[self window] setFrame:[self rectForState:YES] display:YES animate:YES];
71 [super expandWindow:sender];
74 - (void)contractWindow:(id)sender {
76 [[self window] setFrame:[self rectForState:NO] display:YES animate:YES];
77 [super contractWindow:sender];
80 - (NSRect)rectForState:(BOOL)shouldExpand {
81 NSRect newRect = initialRect;
82 NSRect screenRect = [[NSScreen mainScreen] frame];
85 newRect.size.width -= 192;
88 return NSOffsetRect(centerRectInRect(newRect, screenRect), 0, (NSHeight(screenRect) / 5));
91 - (NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow *)sheet usingRect:(NSRect)rect {
92 return NSOffsetRect(NSInsetRect(rect, 8, 0), 0, 0);
95 - (NSTimeInterval)animationResizeTime:(NSRect)newWindowFrame {